#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QtGui>
#include <QGLWidget>

#include "sct/core/mutex.h"

#include "renderinterface.h"

using namespace sct;

class GLWidget : public QGLWidget, public CRenderInterface
{
    Q_OBJECT

public:
    GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0);
    ~GLWidget();

    QSize minimumSizeHint() const;
    QSize sizeHint() const;

    virtual void updatePicture(const void*d, const int w, const int h);
protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int width, int height);

private:
    int mNeedDeleteTexture;
    GLuint mTextures[1];

    CMutex * mMutex;
    uint8_t* mPictureData;
    int mPictureWidth;
    int mPictureHeight;
};

#endif
